package heima3_2.cn.osc.presenter;

import android.util.Log;

import java.util.List;

import heima3_2.cn.osc.model.bean.ExploreEventBean;
import heima3_2.cn.osc.ui.activity_fragment.RecentlyActivityFragment;
import retrofit2.Call;
import retrofit2.Response;

/**
 * Created by emily on 2017/1/16.
 */

public class ExerciseRecentlyPresenter extends BasePresenter<ExploreEventBean>{
        RecentlyActivityFragment recentlyActivityFragment;

    public ExerciseRecentlyPresenter(RecentlyActivityFragment recentlyActivityFragment) {
        this.recentlyActivityFragment = recentlyActivityFragment;
    }


    @Override
    protected void getFailureData(Throwable t) {

    }

    @Override
    protected void getSuccessData(Response<ExploreEventBean> response) {
        ExploreEventBean body = response.body();
        List<ExploreEventBean.EventBean> events = body.getEvents();
        recentlyActivityFragment.exerciseRecentlyAdapater.setDatas(events);
        Log.d("5555555555",body+"");
    }

    @Override
    public void getData(int pager) {
        Call<ExploreEventBean> info = mRetrofitInterface.getExploreEventInfo(-1,0,20);
        info.enqueue(mCallback);
    }
}
